package com.hqyj.utile;

import org.apache.shiro.crypto.hash.Md5Hash;
import org.apache.shiro.crypto.hash.SimpleHash;
import org.junit.Test;
import org.springframework.stereotype.Component;

@Component
public class MdFive {

    @Test
    public static void main(String[] args) {
        MdFive mf = new MdFive();
        String pwd = mf.encrypt("123","韩金轮");
        System.out.println(pwd);
    }
    /**
     *
     * @param password 要加密的密码
     * @param saltValue 盐值
     * @return
     */
    public static String encrypt(String password,String saltValue){
        Object salt = new Md5Hash(saltValue);
        Object result = new SimpleHash("MD5", password, salt, 1024);
        return result+"";
    }

}
